<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>pc、h5项目踩坑 | mozihao</title><meta name="keywords" content="pc、h5项目"><meta name="author" content="mozihao"><meta name="copyright" content="mozihao"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="html2canvas插件的使用—–分享海报绘制功能安装依赖： 1npm install --save html2canvas    html: 123&lt;div id&#x3D;&quot;posters&quot;&gt;    dom画布内容&lt;&#x2F;div&gt;  js 1234567891011121314151617181920212223242526272829303132333435&amp;">
<meta property="og:type" content="article">
<meta property="og:title" content="pc、h5项目踩坑">
<meta property="og:url" content="https://mo_zi_hao.gitee.io/blog/posts/43904/index.html">
<meta property="og:site_name" content="mozihao">
<meta property="og:description" content="html2canvas插件的使用—–分享海报绘制功能安装依赖： 1npm install --save html2canvas    html: 123&lt;div id&#x3D;&quot;posters&quot;&gt;    dom画布内容&lt;&#x2F;div&gt;  js 1234567891011121314151617181920212223242526272829303132333435&amp;">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/4560.jpg">
<meta property="article:published_time" content="2021-08-29T15:22:14.597Z">
<meta property="article:modified_time" content="2021-08-29T15:22:14.597Z">
<meta property="article:author" content="mozihao">
<meta property="article:tag" content="pc、h5项目">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/4560.jpg"><link rel="shortcut icon" href="/blog/img/favicon.png"><link rel="canonical" href="https://mo_zi_hao.gitee.io/blog/posts/43904/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/blog/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/blog/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-08-29 23:22:14'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    })(window)</script><link rel="stylesheet" type="text/css" href="./css/iconfont.css" media="all"><meta name="generator" content="Hexo 5.4.2"><link rel="alternate" href="/blog/atom.xml" title="mozihao" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BC008.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">24</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/blog/tags/"><div class="headline">标签</div><div class="length-num">16</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">11</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/blog/about/"><i class="fa-fw fas fa-heart"></i><span> 前端知识思维导图</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://gitee.com/mo_zi_hao/picsBed/raw/master/image/4560.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/blog/">mozihao</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/blog/about/"><i class="fa-fw fas fa-heart"></i><span> 前端知识思维导图</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">pc、h5项目踩坑</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-08-29T15:22:14.597Z" title="发表于 2021-08-29 23:22:14">2021-08-29</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-08-29T15:22:14.597Z" title="更新于 2021-08-29 23:22:14">2021-08-29</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/blog/categories/%E9%A1%B9%E7%9B%AE%E8%B8%A9%E5%9D%91/">项目踩坑</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">3.2k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>12分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="pc、h5项目踩坑"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h2 id="html2canvas插件的使用—–分享海报绘制功能"><a href="#html2canvas插件的使用—–分享海报绘制功能" class="headerlink" title="html2canvas插件的使用—–分享海报绘制功能"></a><strong>html2canvas插件的使用—–分享海报绘制功能</strong></h2><p>安装依赖：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install --save html2canvas</span><br></pre></td></tr></table></figure>



<p>html:</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">&quot;posters&quot;</span>&gt;</span></span><br><span class="line">    dom画布内容</span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>js</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line">&lt;script&gt;</span><br><span class="line"><span class="keyword">import</span> html2canvas <span class="keyword">from</span> <span class="string">&#x27;html2canvas&#x27;</span>;</span><br><span class="line"></span><br><span class="line">data:&#123;</span><br><span class="line">  <span class="keyword">return</span> &#123;</span><br><span class="line">      canvasImg: <span class="string">&quot;&quot;</span></span><br><span class="line">  &#125;  </span><br><span class="line">&#125;,</span><br><span class="line"></span><br><span class="line">methods:&#123;</span><br><span class="line">    <span class="function"><span class="title">loadingPosters</span>(<span class="params"></span>)</span> &#123;</span><br><span class="line">                <span class="keyword">if</span> (<span class="built_in">this</span>.canvasImg) &#123;</span><br><span class="line">                    <span class="keyword">return</span></span><br><span class="line">                &#125;</span><br><span class="line">                <span class="comment">//解决截图不全问题</span></span><br><span class="line">                <span class="built_in">window</span>.pageYoffset = <span class="number">0</span>;</span><br><span class="line">               <span class="built_in">document</span>.documentElement.scrollTop = <span class="number">0</span>;</span><br><span class="line">               <span class="built_in">document</span>.body.scrollTop = <span class="number">0</span>;</span><br><span class="line">               <span class="comment">//截图方法调用</span></span><br><span class="line">               html2canvas(<span class="built_in">document</span>.getElementById(<span class="string">&#x27;posters&#x27;</span>), &#123;</span><br><span class="line">                        width: <span class="built_in">document</span>.getElementById(<span class="string">&#x27;posters&#x27;</span>).offsetWidth,   <span class="comment">//获取dom的宽度</span></span><br><span class="line">                        height: <span class="built_in">document</span>.getElementById(<span class="string">&#x27;posters&#x27;</span>).offsetHeight,    <span class="comment">//获取dom的高度</span></span><br><span class="line">                        useCORS: <span class="literal">true</span>,    <span class="comment">//允许跨域，重点：需要后端配置图片url跨域!!!,否则拿接口的图片url会出现跨域问题导致无法显示</span></span><br><span class="line">                        logging: <span class="literal">true</span>,    <span class="comment">//启用日志以进行调试,查看html2canvas的内部执行流程</span></span><br><span class="line">                        scrollY: <span class="number">0</span>,       <span class="comment">//解决偏移问题</span></span><br><span class="line">                        scrollX: <span class="number">0</span>,      <span class="comment">//解决偏移问题</span></span><br><span class="line">                        backgroundColor: <span class="literal">null</span>     <span class="comment">//背景颜色为null为透明（默认是白色，可能海报会留白边的情况）</span></span><br><span class="line">                    &#125;)</span><br><span class="line">                    .then(<span class="function"><span class="params">canvas</span> =&gt;</span> &#123;</span><br><span class="line">                        <span class="keyword">var</span> pageData = canvas.toDataURL(<span class="string">&#x27;image/jpeg&#x27;</span>, <span class="number">1.0</span>);    <span class="comment">//生成一个base64的图片</span></span><br><span class="line">                        <span class="built_in">this</span>.canvasImg = pageData    </span><br><span class="line">                    &#125;)</span><br><span class="line">            &#125;,</span><br><span class="line">&#125;</span><br><span class="line">&lt;/script&gt;</span><br></pre></td></tr></table></figure>

<h2 id="踩坑："><a href="#踩坑：" class="headerlink" title="踩坑："></a>踩坑：</h2><h3 id="1-截图不全问题："><a href="#1-截图不全问题：" class="headerlink" title="1.截图不全问题："></a>1.截图不全问题：</h3><p>如果出现截图不全的问题，可以试一下在调用html2canvas方法截图之前，将滚动条置顶</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">window</span>.pageYoffset = <span class="number">0</span>;                </span><br><span class="line"><span class="built_in">document</span>.documentElement.scrollTop = <span class="number">0</span>;                </span><br><span class="line"><span class="built_in">document</span>.body.scrollTop = <span class="number">0</span>;</span><br></pre></td></tr></table></figure>

<h3 id="2-配置属性以及属性对应属性解决的相关问题："><a href="#2-配置属性以及属性对应属性解决的相关问题：" class="headerlink" title="2.配置属性以及属性对应属性解决的相关问题："></a>2.配置属性以及属性对应属性解决的相关问题：</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">html2canvas(dom, &#123;  </span><br><span class="line">width: dom.offsetWidth, <span class="comment">//dom的宽度 </span></span><br><span class="line">height:dom.offsetHeight, <span class="comment">//dom的高度 </span></span><br><span class="line">useCORS: <span class="literal">true</span>,    <span class="comment">//允许跨域，重点：需要后端配置图片url允许跨域!!!,否则拿接口的图片url会出现跨域问题导致无法显示</span></span><br><span class="line">logging: <span class="literal">true</span>,    <span class="comment">//启用日志以进行调试,查看html2canvas的内部执行流程                         </span></span><br><span class="line">scrollY: <span class="number">0</span>, <span class="comment">//解决截图偏移问题   </span></span><br><span class="line">scrollX: <span class="number">0</span>, <span class="comment">//解决截图偏移问题 </span></span><br><span class="line">backgroundColor: <span class="literal">null</span>     <span class="comment">//背景颜色为null为透明（默认是白色，如果绘制出来留白边的情况，可以试一下配置一下这个）                 </span></span><br><span class="line">&#125;).then(<span class="function"><span class="params">canvas</span> =&gt;</span> &#123;                         </span><br><span class="line"><span class="keyword">var</span> pageData = canvas.toDataURL(<span class="string">&#x27;image/jpeg&#x27;</span>, <span class="number">1.0</span>);        </span><br><span class="line">&#125;)</span><br></pre></td></tr></table></figure>

<h3 id="3-dom过长截图不全的问题"><a href="#3-dom过长截图不全的问题" class="headerlink" title="3.dom过长截图不全的问题"></a>3.dom过长截图不全的问题</h3><p>在你的<strong>分享海报比较长的时候</strong>，就要注意了（比较短的就无需理会），<strong>试过海报长度有上1000px</strong>的将绘制的方法放在nextTick上执行也还是会出现截图不全的情况，需要将<strong>该绘制方法放在一个定时器中</strong>绘制，在下一个宏任务执行（<strong>可能是因为dom太长，还没渲染完毕就执行的绘制的方法，导致截图不全的情况</strong>）</p>
<p><strong>另一个解决方案是</strong>：先显示dom给用户看，当用户先下载图片的时候，才使用html2canvas生成图片</p>
<h3 id="4-文本省略"><a href="#4-文本省略" class="headerlink" title="4.文本省略"></a>4.文本省略</h3><p><strong>html2canvas使用text-overflow：ellipsis实现文本省略是不生效的</strong>，如果需要实现省略功能只能通过js实现——通过计算限定文本不可超过的高度，然后通过js手动截取文字在末尾添加省略号（…）</p>
<p>解决方案：使用js解决</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// el 对应文本的dom对象</span></span><br><span class="line"><span class="comment">//height 高度 =  文本的行高 * 需要显示的行数</span></span><br><span class="line"><span class="function"><span class="title">overflowHiddon</span>(<span class="params">el,height</span>)</span> &#123;     </span><br><span class="line">  <span class="keyword">var</span> s = el.textContent || el.innerText;     </span><br><span class="line">  <span class="keyword">var</span> n = el.offsetHeight;     </span><br><span class="line">  <span class="keyword">for</span> (<span class="keyword">var</span> i = <span class="number">1</span>; i &lt;= s.length; i++) &#123;        </span><br><span class="line">    el.innerHTML = s.substr(<span class="number">0</span>, i);        </span><br><span class="line">    <span class="keyword">if</span> (height &lt; el.scrollHeight) &#123;           </span><br><span class="line">        el.style.overflow = <span class="string">&#x27;hidden&#x27;</span>;           </span><br><span class="line">        el.innerHTML = s.substr(<span class="number">0</span>, i - <span class="number">3</span>) + <span class="string">&#x27;...&#x27;</span>;           </span><br><span class="line">        <span class="keyword">break</span>;       </span><br><span class="line">    &#125;                         </span><br><span class="line"> &#125;           </span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>使用：</p>
<p>html:</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">&quot;posters-title&quot;</span> <span class="attr">class</span>=<span class="string">&quot;posters-title&quot;</span>&gt;</span>&#123;&#123; postersData.title &#125;&#125;<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>js:</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">this</span>.$nextTick(<span class="function"><span class="params">_</span>=&gt;</span>&#123;</span><br><span class="line">    <span class="keyword">var</span> text = <span class="built_in">document</span>.getElementsByClassName(<span class="string">&#x27;posters-title&#x27;</span>);</span><br><span class="line">     <span class="keyword">for</span> (<span class="keyword">var</span> i = <span class="number">0</span>; i &lt; text.length; i++) &#123;</span><br><span class="line">          <span class="built_in">this</span>.overflowHiddon(text[i]，<span class="number">40</span> * <span class="number">2</span>);</span><br><span class="line">     &#125;</span><br><span class="line">&#125;)</span><br><span class="line"></span><br><span class="line"><span class="comment">//height为文字的行高</span></span><br><span class="line"><span class="function"><span class="title">overflowHiddon</span>(<span class="params">el,height</span>)</span> &#123;</span><br><span class="line">    <span class="keyword">var</span> s = el.textContent || el.innerText;</span><br><span class="line">    <span class="keyword">var</span> n = el.offsetHeight;</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">var</span> i = <span class="number">1</span>; i &lt;= s.length; i++) &#123;</span><br><span class="line">       el.innerHTML = s.substr(<span class="number">0</span>, i);</span><br><span class="line">       <span class="keyword">if</span> (height &lt; el.scrollHeight) &#123;</span><br><span class="line">          el.style.overflow = <span class="string">&#x27;hidden&#x27;</span>;</span><br><span class="line">          el.innerHTML = s.substr(<span class="number">0</span>, i - <span class="number">3</span>) + <span class="string">&#x27;...&#x27;</span>;</span><br><span class="line">          <span class="keyword">break</span>;</span><br><span class="line">      &#125;</span><br><span class="line">                    </span><br><span class="line">   &#125;          </span><br><span class="line">&#125;,</span><br></pre></td></tr></table></figure>

<h3 id="5-省略号边框的绘制"><a href="#5-省略号边框的绘制" class="headerlink" title="5.省略号边框的绘制"></a>5.省略号边框的绘制</h3><p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image.png" alt="示例"></p>
<p><strong>html2canvas不兼容省略号的边框（生成的图片的省略号边框会是一条实线）：</strong></p>
<p>解决方案：使用在想要加省略号边框的元素使用伪元素，伪元素的content内容为●●●●(这个点是输入法的，在符号中找，不然键盘的那个点太小了使用font-size调大会出现行高很大，那个点很小的情况)，这个点输入尽可能多，给一下width：100%和overflow：hidden就好了，然后再设置一下字体间距css的letter-spacing，设置一下字体颜色，那就可以实现虚线的效果了。然后给一下行高和使用绝对定位和transform定位到你想要的位置即可</p>
<h3 id="7-截图模糊问题"><a href="#7-截图模糊问题" class="headerlink" title="7.截图模糊问题"></a>7.截图模糊问题</h3><p><strong>html2canvas有一个scale属性</strong>，这个属性的默认值的是window.devicePixelRatio（设备像素比），下面是我去文档截的图</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/trzbvbiyaiaq.png" alt="devicePixelRatio"></p>
<p>如果你所要绘制的图片相对于浏览器是比较小的话，很可能生成的像素并不是很高，例如下面这张图</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/pmdvpcdgurtg.png"></p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image.png" alt="示例"></p>
<p>像这张图生成出来后，我发送到手机上看是相对比较模糊的，因为手机上点预览会是放大到手机屏幕的最大宽度，所以图片可能会被放大，那么这张图的像素不够的话显然是会出现模糊的情况的</p>
<p><strong>解决方案：</strong></p>
<p>所以我们在使用html2canvas截图的时候我们将scale这个属性设置为2，将他的像素放大两倍，那么就可以解决截图模糊的问题了（如果还是模糊可以试试再调大一点）</p>
<h3 id="分享也当然少不了下载功能和复制链接功能了"><a href="#分享也当然少不了下载功能和复制链接功能了" class="headerlink" title="分享也当然少不了下载功能和复制链接功能了"></a>分享也当然少不了下载功能和复制链接功能了</h3><p><strong>复制链接方法</strong></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="title">copyLink</span>(<span class="params"></span>)</span> &#123;</span><br><span class="line">     <span class="keyword">let</span> copyLink = <span class="built_in">document</span>.getElementById(<span class="string">&#x27;copyLink&#x27;</span>)</span><br><span class="line">     copyLink.value = <span class="built_in">window</span>.location.href</span><br><span class="line">     copyLink.select()</span><br><span class="line">     <span class="keyword">try</span> &#123;</span><br><span class="line">       <span class="built_in">document</span>.execCommand(<span class="string">&#x27;copy&#x27;</span>);</span><br><span class="line">       <span class="built_in">console</span>.log(<span class="string">&quot;复制成功&quot;</span>)</span><br><span class="line">     &#125; <span class="keyword">catch</span> (e) &#123;</span><br><span class="line">      <span class="built_in">console</span>.log(<span class="string">&quot;复制失败&quot;</span>)</span><br><span class="line">    &#125;</span><br><span class="line">&#125;,</span><br></pre></td></tr></table></figure>



<p>移动端无法下载base64的图片需要转换类型再下载</p>
<p>base64转blob类型</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="title">base64ToBlob</span>(<span class="params">downLoad, base64Img</span>)</span> &#123;</span><br><span class="line">                <span class="keyword">var</span> blob = getBlob(base64Img);</span><br><span class="line">                <span class="built_in">console</span>.log(blob)</span><br><span class="line">                downLoad.setAttribute(<span class="string">&#x27;href&#x27;</span>, URL.createObjectURL(blob));</span><br><span class="line"></span><br><span class="line">                <span class="function"><span class="keyword">function</span> <span class="title">getBlob</span>(<span class="params">base64</span>) </span>&#123;</span><br><span class="line">                    <span class="built_in">console</span>.log(getContentType(base64))</span><br><span class="line">                    <span class="keyword">return</span> b64toBlob(getData(base64), getContentType(base64));</span><br><span class="line">                &#125;</span><br><span class="line"></span><br><span class="line">                <span class="function"><span class="keyword">function</span> <span class="title">getContentType</span>(<span class="params">base64</span>) </span>&#123;</span><br><span class="line">                    <span class="keyword">return</span> <span class="regexp">/data:([^;]*);/i</span>.exec(base64)[<span class="number">1</span>];</span><br><span class="line">                &#125;</span><br><span class="line"></span><br><span class="line">                <span class="function"><span class="keyword">function</span> <span class="title">getData</span>(<span class="params">base64</span>) </span>&#123;</span><br><span class="line">                    <span class="keyword">return</span> base64.substr(base64.indexOf(<span class="string">&quot;base64,&quot;</span>) + <span class="number">7</span>, base64.length);</span><br><span class="line">                &#125;</span><br><span class="line"></span><br><span class="line">                <span class="function"><span class="keyword">function</span> <span class="title">b64toBlob</span>(<span class="params">b64Data, contentType, sliceSize</span>) </span>&#123;</span><br><span class="line">                    contentType = contentType || <span class="string">&#x27;&#x27;</span>;</span><br><span class="line">                    sliceSize = sliceSize || <span class="number">512</span>;</span><br><span class="line"></span><br><span class="line">                    <span class="keyword">var</span> byteCharacters = atob(b64Data);</span><br><span class="line">                    <span class="keyword">var</span> byteArrays = [];</span><br><span class="line"></span><br><span class="line">                    <span class="keyword">for</span> (<span class="keyword">var</span> offset = <span class="number">0</span>; offset &lt; byteCharacters.length; offset += sliceSize) &#123;</span><br><span class="line">                        <span class="keyword">var</span> slice = byteCharacters.slice(offset, offset + sliceSize);</span><br><span class="line"></span><br><span class="line">                        <span class="keyword">var</span> byteNumbers = <span class="keyword">new</span> <span class="built_in">Array</span>(slice.length);</span><br><span class="line">                        <span class="keyword">for</span> (<span class="keyword">var</span> i = <span class="number">0</span>; i &lt; slice.length; i++) &#123;</span><br><span class="line">                            byteNumbers[i] = slice.charCodeAt(i);</span><br><span class="line">                        &#125;</span><br><span class="line"></span><br><span class="line">                        <span class="keyword">var</span> byteArray = <span class="keyword">new</span> <span class="built_in">Uint8Array</span>(byteNumbers);</span><br><span class="line"></span><br><span class="line">                        byteArrays.push(byteArray);</span><br><span class="line">                    &#125;</span><br><span class="line"></span><br><span class="line">                    <span class="keyword">var</span> blob = <span class="keyword">new</span> Blob(byteArrays, &#123;</span><br><span class="line">                        type: contentType</span><br><span class="line">                    &#125;);</span><br><span class="line">                    <span class="keyword">return</span> blob;</span><br><span class="line">                &#125;</span><br><span class="line">&#125;,</span><br></pre></td></tr></table></figure>



<p>但是下载<strong>blob类型</strong>手机系统浏览器下载出现兼容问题，有的手机下载后是无法打开的，所以这里需要<strong>后端上传接口返回一个下载链接，通过a标签的download属性进行下载</strong></p>
<h2 id="文件、图片下载"><a href="#文件、图片下载" class="headerlink" title="文件、图片下载"></a><strong>文件、图片下载</strong></h2><h3 id="1-下载使用接口返回流的形式下载"><a href="#1-下载使用接口返回流的形式下载" class="headerlink" title="1. 下载使用接口返回流的形式下载"></a><strong>1. 下载使用接口返回流的形式下载</strong></h3><p><strong>问题原因：</strong>下载是通过请求接口，接口返回流的形式实现。接口报错，因此下载失败。</p>
<p><strong>解决方案：</strong>解决接口报错问题；使用a标签的download属性下载，但要注意href地址不能跨域，跨域download属性会失效，而文件地址是存放在cos的，因此要把文件放到项目服务器下或者是使用nginx配置转发规则指向cos地址</p>
<h3 id="2-如果没有使用接口返回流的形式下载文件"><a href="#2-如果没有使用接口返回流的形式下载文件" class="headerlink" title="2. 如果没有使用接口返回流的形式下载文件"></a><strong>2. 如果没有使用接口返回流的形式下载文件</strong></h3><p><strong>pc端</strong>：使用a标签的download属性下载没有问题，但下载的文件附件、图片需要返回的链接是下载的链接而不是预览链接</p>
<p><strong>h5端</strong>: 使用下载的方法有以下两种</p>
<p><strong>1. iframe实现下载（ios不支持iframe）</strong></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//在h5中ios不兼容iframe</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">downloadFile</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">    <span class="keyword">var</span> src = file.fileUrl;</span><br><span class="line">    <span class="keyword">var</span> iframe = <span class="built_in">document</span>.createElement(<span class="string">&#x27;iframe&#x27;</span>);</span><br><span class="line">    iframe.style.display = <span class="string">&#x27;none&#x27;</span>;</span><br><span class="line">    iframe.src = <span class="string">&quot;javascript: &#x27;&lt;script&gt;location.href=\&quot;&quot;</span> + src + <span class="string">&quot;\&quot;&lt;\/script&gt;&#x27;&quot;</span>;</span><br><span class="line">    <span class="built_in">document</span>.getElementsByTagName(<span class="string">&#x27;body&#x27;</span>)[<span class="number">0</span>].appendChild(iframe);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p><strong>2. a标签的download属性下载</strong></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//如果使用遍历，a标签只会弹出最后一个</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">downloadFile</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">    <span class="keyword">let</span> title = file.fileName + <span class="string">&#x27;.&#x27;</span> + file.fileType</span><br><span class="line">    <span class="keyword">var</span> linkDom = <span class="built_in">document</span>.createElement(<span class="string">&#x27;a&#x27;</span>)</span><br><span class="line">    linkDom.setAttribute(<span class="string">&#x27;href&#x27;</span>, file.fileUrl)</span><br><span class="line">    linkDom.setAttribute(<span class="string">&#x27;download&#x27;</span>, title)</span><br><span class="line">    <span class="built_in">document</span>.body.appendChild(linkDom)</span><br><span class="line">    <span class="built_in">setTimeout</span>(<span class="function">() =&gt;</span> &#123;</span><br><span class="line">      linkDom.click()</span><br><span class="line">      <span class="built_in">document</span>.body.removeChild(linkDom)</span><br><span class="line">    &#125;, <span class="number">60</span>)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>



<h3 id="批量下载"><a href="#批量下载" class="headerlink" title="批量下载"></a><strong>批量下载</strong></h3><p>其中有一个需求是实现批量下载，没有使用流的形式，这里只能是使用遍历模拟批量下载，但是由于手机浏览器在下载之前是需要点击确认后才能下载的，确认后会出现跳转到浏览器下载的页面，然后返回接着点击下一个下载的文件的弹窗</p>
<p><strong>！！！最后考虑到ios兼容性的问题，还是需要服务端返回一个压缩包下载比较好</strong></p>
<p><strong>模拟批量下载（交互不太好）：</strong></p>
<p>遍历iframe实现下载的方法是可以实现以上的需求，但是ios不兼容</p>
<p>遍历a标签的download属性，发现只能弹出最后一个a标签的下载弹出，并不能实现像上面的那种模拟遍历的下载</p>
<p><strong>当下载的文件是图片</strong></p>
<p>当下载的文件是图片的格式的时候，试过iframe的下载方式是不能用的，后来用的a标签的download属性下载</p>
<p><strong>！！！注意</strong>：图片的链接的安全证书要保证没有过期，如果过期了，那么手机浏览器下载图片会出现下载失败的情况（uc浏览器除外）</p>
<h3 id="在h5中判断手机系统"><a href="#在h5中判断手机系统" class="headerlink" title="在h5中判断手机系统"></a>在h5中判断手机系统</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> u = navigator.userAgent;</span><br><span class="line"><span class="keyword">var</span> isAndroid = u.indexOf(<span class="string">&#x27;Android&#x27;</span>) &gt; -<span class="number">1</span> || u.indexOf(<span class="string">&#x27;Adr&#x27;</span>) &gt; -<span class="number">1</span>; <span class="comment">//android终端</span></span><br><span class="line"><span class="keyword">var</span> isiOS = !!u.match(<span class="regexp">/\(i[^;]+;( U;)? CPU.+Mac OS X/</span>); <span class="comment">//ios终端</span></span><br></pre></td></tr></table></figure>



<h2 id="vue中使用qrcodejs2插件生成二维码"><a href="#vue中使用qrcodejs2插件生成二维码" class="headerlink" title="vue中使用qrcodejs2插件生成二维码"></a>vue中使用qrcodejs2插件生成二维码</h2><p>安装qrcodejs2插件</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install qrcodejs2 --save</span><br></pre></td></tr></table></figure>



<p>页面中引入</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> QRCode <span class="keyword">from</span> <span class="string">&#x27;qrcodejs2&#x27;</span></span><br></pre></td></tr></table></figure>



<p>在对应的Html页面中，添加html标签</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">&lt;div id=<span class="string">&quot;qrcode&quot;</span> ref=<span class="string">&quot;qrcode&quot;</span>&gt;&lt;/div&gt;</span><br></pre></td></tr></table></figure>



<p>配置，在methods方法里配置</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">qrcode () &#123;</span><br><span class="line">    <span class="keyword">let</span> $qrcode = <span class="built_in">document</span>.getElementById(<span class="string">&#x27;qrcode&#x27;</span>)</span><br><span class="line">    <span class="keyword">let</span> qrcode = <span class="keyword">new</span> QRCode(<span class="string">&#x27;qrcode&#x27;</span>,&#123;</span><br><span class="line">        width: $qrcode.offsetWidth, <span class="comment">// 设置宽度，单位像素</span></span><br><span class="line">        height: $qrcode.offsetHeight, <span class="comment">// 设置高度，单位像素</span></span><br><span class="line">        text: <span class="string">&#x27;https://www.baidu.com&#x27;</span>   <span class="comment">// 设置二维码内容或跳转地址</span></span><br><span class="line">    &#125;)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>



<p>调用</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">this</span>.$nextTick(<span class="function">() =&gt;</span> &#123;</span><br><span class="line">    <span class="built_in">this</span>.qrcode()</span><br><span class="line">&#125;)</span><br></pre></td></tr></table></figure>



<h2 id="移动端适配方式"><a href="#移动端适配方式" class="headerlink" title="移动端适配方式"></a>移动端适配方式</h2><p>使用插件amfe-flexible，font-size的根元素大小由设计稿决定，如果ui设计稿按照375的宽度为标准，那么font-size的根元素大小为37.5</p>
<p>由上面插件计算出屏幕适配的font-size的大小</p>
<p>通过postcss-pxtorem插件进行全局转换成rem进行移动端的适配</p>
<p>px单位的像素 /  根元素font-size = 适配的比例</p>
<p>适配的px = 适配比例 * 当前根元素的font-size</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">npm install postcss-pxtorem --save-dev</span><br><span class="line">npm install amfe-flexible --save</span><br></pre></td></tr></table></figure>



<h3 id="1-在Vue-的main-js中引入amfe-flexible"><a href="#1-在Vue-的main-js中引入amfe-flexible" class="headerlink" title="1.在Vue 的main.js中引入amfe-flexible"></a>1.在Vue 的main.js中引入amfe-flexible</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span>  <span class="string">&#x27;amfe-flexible&#x27;</span>;</span><br></pre></td></tr></table></figure>



<h3 id="2-在-postcssrc-js-中配置，vue-cli3-0-的版本在postcss-config-js中配置。"><a href="#2-在-postcssrc-js-中配置，vue-cli3-0-的版本在postcss-config-js中配置。" class="headerlink" title="2.在.postcssrc.js 中配置，vue-cli3.0 的版本在postcss.config.js中配置。"></a>2.在.postcssrc.js 中配置，vue-cli3.0 的版本在postcss.config.js中配置。</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">module</span>.exports = &#123;</span><br><span class="line">  <span class="string">&quot;plugins&quot;</span>: &#123;</span><br><span class="line">    <span class="string">&#x27;autoprefixer&#x27;</span>: &#123;</span><br><span class="line">      browsers: [<span class="string">&#x27;Android &gt;= 4.0&#x27;</span>, <span class="string">&#x27;iOS &gt;= 7&#x27;</span>]</span><br><span class="line">    &#125;,</span><br><span class="line">    <span class="string">&#x27;postcss-pxtorem&#x27;</span>: &#123;</span><br><span class="line">      rootValue: <span class="number">37.5</span>,</span><br><span class="line">      propList: [<span class="string">&#x27;*&#x27;</span>]</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>



<p>//当前页面的根字体大小</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">document</span>.documentElement.clientWidth / <span class="number">10</span>    <span class="comment">//当前页面的根字体大小</span></span><br></pre></td></tr></table></figure>



<h2 id="手机浏览器调试—-手机的浏览器会有一个console-按钮"><a href="#手机浏览器调试—-手机的浏览器会有一个console-按钮" class="headerlink" title="手机浏览器调试—-手机的浏览器会有一个console 按钮"></a>手机浏览器调试—-手机的浏览器会有一个console 按钮</h2><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">&lt;script type=<span class="string">&quot;text/javascript&quot;</span> src=<span class="string">&quot;https://cdn.bootcss.com/vConsole/3.3.0/vconsole.min.js&quot;</span>&gt;&lt;/script&gt;</span><br><span class="line"> </span><br><span class="line">&lt;script&gt;</span><br><span class="line">    <span class="comment">// 初始化</span></span><br><span class="line">    <span class="keyword">var</span> vConsole = <span class="keyword">new</span> VConsole();</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">&#x27;Hello world&#x27;</span>);</span><br><span class="line">&lt;/script&gt;</span><br></pre></td></tr></table></figure>



<h2 id="h5调用手机拨号发短信功能"><a href="#h5调用手机拨号发短信功能" class="headerlink" title="h5调用手机拨号发短信功能"></a>h5调用手机拨号发短信功能</h2><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span>里面加上：<span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">&quot;format-detection&quot;</span> <span class="attr">content</span>=<span class="string">&quot;telephone=yes&quot;</span>/&gt;</span></span><br><span class="line">需要拨打电话的地方：<span class="tag">&lt;<span class="name">a</span> <span class="attr">href</span>=<span class="string">&quot;tel:400-0000-688&quot;</span>&gt;</span>400-0000-688<span class="tag">&lt;/<span class="name">a</span>&gt;</span></span><br><span class="line">发短信：<span class="tag">&lt;<span class="name">a</span> <span class="attr">href</span>=<span class="string">&quot;sms:18688888888&quot;</span>&gt;</span>发短信<span class="tag">&lt;/<span class="name">a</span>&gt;</span></span><br></pre></td></tr></table></figure>

<h2 id="ios不兼容new-Date中的使用-“-“"><a href="#ios不兼容new-Date中的使用-“-“" class="headerlink" title="ios不兼容new Date中的使用  “-“"></a>ios不兼容new Date中的使用  “-“</h2><p>var date =new Date(“2021-03-15 20:50”);     //ios   NaN<br>解决方案：使用”/“代替”-“</p>
<h2 id="动画抖动"><a href="#动画抖动" class="headerlink" title="动画抖动"></a>动画抖动</h2><p>开屏动画，出现抖动的情况，是因为没有启动硬件加速的原因，解决方案启动硬件加速，方式有：translate3D，translateZ，transform<br>.css{<br>-webkit-transform: translate3d(0,0,0);<br>-moz-transform: translate3d(0,0,0);<br>-ms-transform: translate3d(0,0,0);<br>transform: translate3d(0,0,0);<br>}</p>
<h2 id="禁止字体调整"><a href="#禁止字体调整" class="headerlink" title="禁止字体调整"></a>禁止字体调整</h2><p>旋转屏幕可能会改变字体大小，声明text-size-adjust:100%让字体大小保持不变。</p>
<p>*{<br>text-size-adjust: 100%;<br>}</p>
<h2 id="对齐输入占位"><a href="#对齐输入占位" class="headerlink" title="对齐输入占位"></a>对齐输入占位</h2><p>有强迫症的同学总会觉得输入框文本位置整体偏上，感觉未居中心里就痒痒的。桌面端浏览器里声明line-height等于height就能解决，但移动端浏览器里还是未能解决，需将line-height声明为normal才行。<br>input {<br>    line-height: normal;<br>}</p>
<h2 id="图片懒加载"><a href="#图片懒加载" class="headerlink" title="图片懒加载"></a>图片懒加载</h2><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">img</span> <span class="attr">data-src</span>=<span class="string">&quot;pig.jpg&quot;</span>&gt;</span></span><br><span class="line"><span class="comment">&lt;!-- 很多&lt;img&gt; --&gt;</span></span><br></pre></td></tr></table></figure>

<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> imgs = <span class="built_in">document</span>.querySelectorAll(<span class="string">&quot;img.lazyload&quot;</span>);</span><br><span class="line"><span class="keyword">const</span> observer = <span class="keyword">new</span> IntersectionObserver(<span class="function"><span class="params">nodes</span> =&gt;</span> &#123;</span><br><span class="line">    nodes.forEach(<span class="function"><span class="params">v</span> =&gt;</span> &#123;</span><br><span class="line">        <span class="keyword">if</span> (v.isIntersecting) &#123; <span class="comment">// 判断是否进入可视区域</span></span><br><span class="line">            v.target.src = v.target.dataset.src; <span class="comment">// 赋值加载图片</span></span><br><span class="line">            observer.unobserve(v.target); <span class="comment">// 停止监听已加载的图片</span></span><br><span class="line">        &#125;</span><br><span class="line">    &#125;);</span><br><span class="line">&#125;);</span><br><span class="line">imgs.forEach(<span class="function"><span class="params">v</span> =&gt;</span> observer.observe(v));</span><br></pre></td></tr></table></figure></article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">mozihao</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://mo_zi_hao.gitee.io/blog/posts/43904/">https://mo_zi_hao.gitee.io/blog/posts/43904/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://mo_zi_hao.gitee.io/blog" target="_blank">mozihao</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/blog/tags/pc%E3%80%81h5%E9%A1%B9%E7%9B%AE/">pc、h5项目</a></div><div class="post_share"><div class="social-share" data-image="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/4560.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/blog/posts/40469/"><img class="prev-cover" src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BCwang5.jpg" onerror="onerror=null;src='/blog/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">从零到白嫖之博客搭建</div></div></a></div><div class="next-post pull-right"><a href="/blog/posts/33426/"><img class="next-cover" src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/000.jpg" onerror="onerror=null;src='/blog/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">git项目管理总结</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-info-avatar is-center"><img class="avatar-img" src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BC008.jpg" onerror="this.onerror=null;this.src='/blog/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">mozihao</div><div class="author-info__description">if you risk nothing,then you risk anthing</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">24</div></a></div><div class="card-info-data-item is-center"><a href="/blog/tags/"><div class="headline">标签</div><div class="length-num">16</div></a></div><div class="card-info-data-item is-center"><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">11</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://gitee.com/mo_zi_hao"><i class="iconfont icon-gitee-fill-round"></i><span>我的Gitee</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://gitee.com/mo_zi_hao" target="_blank" title="Gitee"><i class="fab iconfont icon-gitee-fill-round"></i></a><a class="social-icon" href="https://github.com/mmCrazy" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="https://blog.csdn.net/xiaomohhh?spm=1001.2101.3001.5343" target="_blank" title="CSDN"><i class="fab iconfont icon-csdn"></i></a><a class="social-icon" href="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/qrcode_for_gh_d35478eda980_430.jpg" target="_blank" title="公众号"><i class="fab iconfont icon-weixingongzhonghao"></i></a><a class="social-icon" href="mailto:747304031@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">如文章中有哪些错漏，欢迎各位前端的大佬与我交流并指正，谢谢!!</br>邮箱：747304031@qq.com</br>公众号：一起写前端bug</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#html2canvas%E6%8F%92%E4%BB%B6%E7%9A%84%E4%BD%BF%E7%94%A8%E2%80%94%E2%80%93%E5%88%86%E4%BA%AB%E6%B5%B7%E6%8A%A5%E7%BB%98%E5%88%B6%E5%8A%9F%E8%83%BD"><span class="toc-number">1.</span> <span class="toc-text">html2canvas插件的使用—–分享海报绘制功能</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%B8%A9%E5%9D%91%EF%BC%9A"><span class="toc-number">2.</span> <span class="toc-text">踩坑：</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-%E6%88%AA%E5%9B%BE%E4%B8%8D%E5%85%A8%E9%97%AE%E9%A2%98%EF%BC%9A"><span class="toc-number">2.1.</span> <span class="toc-text">1.截图不全问题：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-%E9%85%8D%E7%BD%AE%E5%B1%9E%E6%80%A7%E4%BB%A5%E5%8F%8A%E5%B1%9E%E6%80%A7%E5%AF%B9%E5%BA%94%E5%B1%9E%E6%80%A7%E8%A7%A3%E5%86%B3%E7%9A%84%E7%9B%B8%E5%85%B3%E9%97%AE%E9%A2%98%EF%BC%9A"><span class="toc-number">2.2.</span> <span class="toc-text">2.配置属性以及属性对应属性解决的相关问题：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-dom%E8%BF%87%E9%95%BF%E6%88%AA%E5%9B%BE%E4%B8%8D%E5%85%A8%E7%9A%84%E9%97%AE%E9%A2%98"><span class="toc-number">2.3.</span> <span class="toc-text">3.dom过长截图不全的问题</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-%E6%96%87%E6%9C%AC%E7%9C%81%E7%95%A5"><span class="toc-number">2.4.</span> <span class="toc-text">4.文本省略</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5-%E7%9C%81%E7%95%A5%E5%8F%B7%E8%BE%B9%E6%A1%86%E7%9A%84%E7%BB%98%E5%88%B6"><span class="toc-number">2.5.</span> <span class="toc-text">5.省略号边框的绘制</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7-%E6%88%AA%E5%9B%BE%E6%A8%A1%E7%B3%8A%E9%97%AE%E9%A2%98"><span class="toc-number">2.6.</span> <span class="toc-text">7.截图模糊问题</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%88%86%E4%BA%AB%E4%B9%9F%E5%BD%93%E7%84%B6%E5%B0%91%E4%B8%8D%E4%BA%86%E4%B8%8B%E8%BD%BD%E5%8A%9F%E8%83%BD%E5%92%8C%E5%A4%8D%E5%88%B6%E9%93%BE%E6%8E%A5%E5%8A%9F%E8%83%BD%E4%BA%86"><span class="toc-number">2.7.</span> <span class="toc-text">分享也当然少不了下载功能和复制链接功能了</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E3%80%81%E5%9B%BE%E7%89%87%E4%B8%8B%E8%BD%BD"><span class="toc-number">3.</span> <span class="toc-text">文件、图片下载</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-%E4%B8%8B%E8%BD%BD%E4%BD%BF%E7%94%A8%E6%8E%A5%E5%8F%A3%E8%BF%94%E5%9B%9E%E6%B5%81%E7%9A%84%E5%BD%A2%E5%BC%8F%E4%B8%8B%E8%BD%BD"><span class="toc-number">3.1.</span> <span class="toc-text">1. 下载使用接口返回流的形式下载</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-%E5%A6%82%E6%9E%9C%E6%B2%A1%E6%9C%89%E4%BD%BF%E7%94%A8%E6%8E%A5%E5%8F%A3%E8%BF%94%E5%9B%9E%E6%B5%81%E7%9A%84%E5%BD%A2%E5%BC%8F%E4%B8%8B%E8%BD%BD%E6%96%87%E4%BB%B6"><span class="toc-number">3.2.</span> <span class="toc-text">2. 如果没有使用接口返回流的形式下载文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%89%B9%E9%87%8F%E4%B8%8B%E8%BD%BD"><span class="toc-number">3.3.</span> <span class="toc-text">批量下载</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9C%A8h5%E4%B8%AD%E5%88%A4%E6%96%AD%E6%89%8B%E6%9C%BA%E7%B3%BB%E7%BB%9F"><span class="toc-number">3.4.</span> <span class="toc-text">在h5中判断手机系统</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#vue%E4%B8%AD%E4%BD%BF%E7%94%A8qrcodejs2%E6%8F%92%E4%BB%B6%E7%94%9F%E6%88%90%E4%BA%8C%E7%BB%B4%E7%A0%81"><span class="toc-number">4.</span> <span class="toc-text">vue中使用qrcodejs2插件生成二维码</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%A7%BB%E5%8A%A8%E7%AB%AF%E9%80%82%E9%85%8D%E6%96%B9%E5%BC%8F"><span class="toc-number">5.</span> <span class="toc-text">移动端适配方式</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-%E5%9C%A8Vue-%E7%9A%84main-js%E4%B8%AD%E5%BC%95%E5%85%A5amfe-flexible"><span class="toc-number">5.1.</span> <span class="toc-text">1.在Vue 的main.js中引入amfe-flexible</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-%E5%9C%A8-postcssrc-js-%E4%B8%AD%E9%85%8D%E7%BD%AE%EF%BC%8Cvue-cli3-0-%E7%9A%84%E7%89%88%E6%9C%AC%E5%9C%A8postcss-config-js%E4%B8%AD%E9%85%8D%E7%BD%AE%E3%80%82"><span class="toc-number">5.2.</span> <span class="toc-text">2.在.postcssrc.js 中配置，vue-cli3.0 的版本在postcss.config.js中配置。</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%89%8B%E6%9C%BA%E6%B5%8F%E8%A7%88%E5%99%A8%E8%B0%83%E8%AF%95%E2%80%94-%E6%89%8B%E6%9C%BA%E7%9A%84%E6%B5%8F%E8%A7%88%E5%99%A8%E4%BC%9A%E6%9C%89%E4%B8%80%E4%B8%AAconsole-%E6%8C%89%E9%92%AE"><span class="toc-number">6.</span> <span class="toc-text">手机浏览器调试—-手机的浏览器会有一个console 按钮</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#h5%E8%B0%83%E7%94%A8%E6%89%8B%E6%9C%BA%E6%8B%A8%E5%8F%B7%E5%8F%91%E7%9F%AD%E4%BF%A1%E5%8A%9F%E8%83%BD"><span class="toc-number">7.</span> <span class="toc-text">h5调用手机拨号发短信功能</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ios%E4%B8%8D%E5%85%BC%E5%AE%B9new-Date%E4%B8%AD%E7%9A%84%E4%BD%BF%E7%94%A8-%E2%80%9C-%E2%80%9C"><span class="toc-number">8.</span> <span class="toc-text">ios不兼容new Date中的使用  “-“</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8A%A8%E7%94%BB%E6%8A%96%E5%8A%A8"><span class="toc-number">9.</span> <span class="toc-text">动画抖动</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%A6%81%E6%AD%A2%E5%AD%97%E4%BD%93%E8%B0%83%E6%95%B4"><span class="toc-number">10.</span> <span class="toc-text">禁止字体调整</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AF%B9%E9%BD%90%E8%BE%93%E5%85%A5%E5%8D%A0%E4%BD%8D"><span class="toc-number">11.</span> <span class="toc-text">对齐输入占位</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9B%BE%E7%89%87%E6%87%92%E5%8A%A0%E8%BD%BD"><span class="toc-number">12.</span> <span class="toc-text">图片懒加载</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/blog/posts/1/" title="无题"><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BC4.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="无题"/></a><div class="content"><a class="title" href="/blog/posts/1/" title="无题">无题</a><time datetime="2022-06-05T05:20:17.974Z" title="发表于 2022-06-05 13:20:17">2022-06-05</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/posts/36549/" title="编写可维护的JavaScript (代码习惯)"><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BC4.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="编写可维护的JavaScript (代码习惯)"/></a><div class="content"><a class="title" href="/blog/posts/36549/" title="编写可维护的JavaScript (代码习惯)">编写可维护的JavaScript (代码习惯)</a><time datetime="2022-03-19T03:12:42.624Z" title="发表于 2022-03-19 11:12:42">2022-03-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/posts/23125/" title="gitlab-cicd"><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/745.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="gitlab-cicd"/></a><div class="content"><a class="title" href="/blog/posts/23125/" title="gitlab-cicd">gitlab-cicd</a><time datetime="2021-12-20T14:00:59.661Z" title="发表于 2021-12-20 22:00:59">2021-12-20</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/posts/449/" title="前端js基础"><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/26&amp;gp=0.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="前端js基础"/></a><div class="content"><a class="title" href="/blog/posts/449/" title="前端js基础">前端js基础</a><time datetime="2021-08-29T15:22:14.600Z" title="发表于 2021-08-29 23:22:14">2021-08-29</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/posts/35506/" title="微信小程序"><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/1234.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="微信小程序"/></a><div class="content"><a class="title" href="/blog/posts/35506/" title="微信小程序">微信小程序</a><time datetime="2021-08-29T15:22:14.600Z" title="发表于 2021-08-29 23:22:14">2021-08-29</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By mozihao</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/blog/js/utils.js"></script><script src="/blog/js/main.js"></script><script src="/blog/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="/blog/js/search/local-search.js"></script><div class="js-pjax"></div><script id="click-heart" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-heart.min.js" async="async" mobile="false"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>